//
//  STLogManger.m
//  ligenyun
//
//  Created by stoneobs on 2018/4/10.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "STLogManger.h"
#import <CocoaLumberjack/CocoaLumberjack.h>
@implementation STLogManger
+ (STLogManger *)defult{
    static STLogManger * defult = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        defult = [STLogManger new];
    });
    return defult;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self configLog];
    }
    return self;
}
- (void)configLog{

    // TTY = Xcode console
    [DDLog addLogger:[DDTTYLogger sharedInstance]];
    // ASL = Apple System Logs
    [DDLog addLogger:[DDASLLogger sharedInstance]];
    
    DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; // File Logger
    fileLogger.rollingFrequency = 60 * 60 * 24 * 3; // 3天覆盖
    fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
    [DDLog addLogger:fileLogger];
    
//    static const int ddLogLevel = LOG_LEVEL_VERBOSE;// 定义日志级别
//
//    DDLogVerbose(@"Verbose");
//    DDLogDebug(@"Debug");
//    DDLogInfo(@"Info");
//    DDLogWarn(@"Warn");
//    DDLogError(@"Error");
}
@end
